package com.link.base.base.order.service;

import com.link.base.base.order.dao.mybatis.mapper.OrderPolicyResultMapper;
import com.link.base.base.order.model.OrderPolicyResult;
import com.link.base.base.policy.model.PcyResult;
import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.service.ServiceException;
import com.link.core.basic.service.BasicServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author unknown
 * @date unknown
 * @comments 定单政策结果服务
 */
@Service
public class OrderPolicyResultServiceImpl extends BasicServiceImpl<OrderPolicyResult> implements OrderPolicyResultService {

    @Resource
    private OrderPolicyResultMapper orderPolicyResultMapper;

    @Override
    public BasicMapper<OrderPolicyResult> getBasicMapper() {
        return orderPolicyResultMapper;
    }


    @Override
    public List<OrderPolicyResult> queryListByOrderId(Long orderId) throws Exception {
        if (orderId == null) {
            throw new ServiceException("ORDER-007");
        }
        OrderPolicyResult example = new OrderPolicyResult();
        example.setOrderId(orderId);
        example.setPageFlag(false);
        return orderPolicyResultMapper.queryByExamplePage(example);
    }


    @Override
    public List<PcyResult> queryPcyResultByOrderId(Long orderId) throws Exception {
        if (orderId == null) {
            throw new ServiceException("ORDER-007");
        }
        OrderPolicyResult example = new OrderPolicyResult();
        example.setOrderId(orderId);
        return orderPolicyResultMapper.queryPcyResultByOrderId(example);
    }
}
